#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
string s;
int main()
{
	getline(cin, s);
	int n = s.size();
	s = " " + s;
	int ma = 0;
	for (int i = 1; i <= n; i++) {
		int idx1 = i - 1;
		int idx2 = i + 1;
		int ans = 1;
		while (s[idx1] == s[idx2] && idx1 >= 1 && idx2 <= n) {
			ans += 2;
			idx1--, idx2++;
		}
		ma = max(ans, ma);
		idx1 = i, idx2 = i + 1;
		ans = 0;
		while (s[idx1] == s[idx2] && idx1 >= 1 && idx2 <= n) {
			ans += 2;
			idx1--, idx2++;
		}
		ma = max(ans, ma);
	}
	cout << ma << endl;
	return 0;
}